<template>
	<view class="wrap">
 <u-tabbar v-model="current" :list="tabBarList" :active-color="activeColor" :inactive-color="inactiveColor" style="position: absolute;"
     :border-top="borderTop" />
		<u-swiper :height="270" :list="imgList" :title="false" @click="imgListClick" style="background-color: white;"></u-swiper>
		<view class="workbench-title" style="background-color: white;">常用应用</view>
		<view class="toolbar">
			<u-grid class="grid" :col="4" :border="false">
				<u-grid-item :index="0" @click="navTo('/pages/sys/workbench/add-form')" >
					<view class="home-icon icon-color01">
						<i class="iconfont icon-qingjia"></i>
					</view>
					<view class="grid-text">请假申请</view>
				</u-grid-item>
				<u-grid-item :index="1" @click="navTo('/pages/sys/clatime/selectTime')">
					<view class="home-icon icon-color04">
						<i class="iconfont icon-hetongguanli"></i>
					</view>
					<view class="grid-text">课时查询</view>
				</u-grid-item>
				<u-grid-item :index="2" @click="navTo('/pages/sys/clatime/claTimeList')">
					<view class="home-icon icon-color03">
						<i class="iconfont icon-chucha"></i>
					</view>
					<view class="grid-text">出差申请</view>
				</u-grid-item>
				<u-grid-item :index="2" @click="navTo('/pages/sys/course/index')">
					<view class="home-icon icon-color12">
						<i class="iconfont icon-ribao"></i>
					</view>
					<view class="grid-text">日报</view>
				</u-grid-item>
				<u-grid-item  @click="navTo('/pages/sys/msg/message')">
					<view class="home-icon icon-color04">
						<i class="iconfont icon-tongzhi"></i>
					</view>
					<view class="grid-text">邮件</view>
				</u-grid-item>
				<u-grid-item  @click="navTo('/pages/sys/cla/index')">
					<view class="home-icon icon-color05">
						<i class="iconfont icon-huiyishi"></i>
					</view>
					<view class="grid-text">班级</view>
				</u-grid-item>
        <u-grid-item :index="2" @click="navTo('/pages/sys/clatime/index')">
        	<view class="home-icon icon-color12">
        		<i class="iconfont icon-kaoqinchuqin"></i>
        	</view>
        	<view class="grid-text">考勤</view>
        </u-grid-item>
        <u-grid-item :index="2" @click="navTo('/pages/sys/student/index')">
        	<view class="home-icon icon-color12">
        		<i class="iconfont icon-ketangdianping"></i>
        	</view>
        	<view class="grid-text">考勤</view>
        </u-grid-item>
		<!-- 		<u-grid-item  @click="navTo('/pages/sys/workbench/install')">
					<view class="home-icon icon-color13">
						<i class="iconfont icon-tianjia" style="color:#90949d;"></i>
					</view>
					<view class="grid-text">添加常用</view>
				</u-grid-item> -->
			</u-grid>
		</view>
 
		<view class="workbench-titles" style="background-color: white;">今日待点名</view>
		<!-- <view class="toolbar"> -->
      <red-empty v-if="current == 0"  img="record" bg="#f6f7f8" text="暂无记录" imgSize="230" height="100rpx"  />
     
     
    <view v-else >
        <u-gap height="25" bg-color="#f5f5f5" ></u-gap>
            <scroll-view class="content" scroll-y style="height: 230px;">
              <!-- 这里是可以滑动的列表内容 -->
              <cc-listView v-if="current == 1" :productList="courseList"  >
                
                 
              </cc-listView>
            </scroll-view>
      		
    
     </view>
			<!-- <u-grid class="grid" :col="4" :border="false">
				<u-grid-item :index="0" @click="navTo('')" >
					<view class="home-icon icon-color04">
						<i class="iconfont icon-yongche"></i>
					</view>
					<view class="grid-text">用车</view>
				</u-grid-item>
				<u-grid-item :index="2" @click="navTo('')">
					<view class="home-icon icon-color03">
						<i class="iconfont icon-jiabanshenqing"></i>
					</view>
					<view class="grid-text">加班</view>
				</u-grid-item>
				<u-grid-item :index="2" @click="navTo('/pages/sys/clatime/index')">
					<view class="home-icon icon-color12">
						<i class="iconfont icon-kaoqinchuqin"></i>
					</view>
					<view class="grid-text">考勤</view>
				</u-grid-item>
				<u-grid-item  @click="navTo('')">
					<view class="home-icon icon-color04">
						<i class="iconfont icon-haocaifei"></i>
					</view>
					<view class="grid-text">耗材</view>
				</u-grid-item>
				<u-grid-item  @click="navTo('')">
					<view class="home-icon icon-color01">
						<i class="iconfont icon-gongwujiedai"></i>
					</view>
					<view class="grid-text">接待</view>
				</u-grid-item>
				<u-grid-item  @click="navTo('')">
					<view class="home-icon icon-color04">
						<i class="iconfont icon-baoming"></i>
					</view>
					<view class="grid-text">报名</view>
				</u-grid-item>
			</u-grid> -->
		<!-- </view> -->
<!-- 		<view class="workbench-title">财务报销</view>
		<view class="toolbar">
			<u-grid class="grid" :col="4" :border="false">
				<u-grid-item :index="0" @click="navTo('')" >
					<view class="home-icon icon-color04">
						<i class="iconfont icon-finance"></i>
					</view>
					<view class="grid-text">费用报销</view>
				</u-grid-item>
				<u-grid-item :index="2" @click="navTo('')">
					<view class="home-icon icon-color03">
						<i class="iconfont icon-mall-bag"></i>
					</view>
					<view class="grid-text">采购申请</view>
				</u-grid-item>
				<u-grid-item :index="2" @click="navTo('')">
					<view class="home-icon icon-color12">
						<i class="iconfont icon-baoxiaodan"></i>
					</view>
					<view class="grid-text">付款申请</view>
				</u-grid-item>
				<u-grid-item  @click="navTo('')">
					<view class="home-icon icon-color04">
						<i class="iconfont icon-shenpi"></i>
					</view>
					<view class="grid-text">用章申请</view>
				</u-grid-item>
			</u-grid>
		</view> -->
		<!-- <u-divider>已经到底了</u-divider> -->
	</view>
	
</template>
<script>
	 import HeadNavBar from '@/components/headnavbar/index';
/**
 * Copyright (c) 2013-Now http://aidex.vip All rights reserved.
 */
export default {
	components: {
	  HeadNavBar
	},
	data() {
		return {
			show: false,
			head: '/static/aidex/images/head.png',
      courseList: [],
			imgList: [
				{image: '/static/aidex/banner/banner01.png'},
				{image: '/static/aidex/banner/banner02.png'}, 
				{image: '/static/aidex/banner/banner03.png'}
			],
			todoCount: 3,
      title: '首页', // 导航栏的标题，这会显示在页面的顶部或作为当前视图的标题
      		 tabBarList: [], // 导航栏的列表项，来源于Vuex状态管理中的dynamicTabbar
               current: 0, // 当前激活的导航项的索引，0表示第一个导航项
               borderTop: true, // 控制是否有顶部边框，true表示有边框
               inactiveColor: '#909399', // 未激活的TabBarItem的颜色
               activeColor: '#5098FF' // 激活的TabBarItem的颜色	
		};
	},
  onLoad() {
      this.tabBarList = this.vuex_tabbar
      this.datechange()
      
      
      

  },
	methods: {
    datechange(e) {
      
      // 获取当前日期
      var currentDate = new Date();
      // 格式化日期
      var year = currentDate.getFullYear();
      var month = ('0' + (currentDate.getMonth() + 1)).slice(-2); // 月份从 0 开始，所以要加 1
      var day = ('0' + currentDate.getDate()).slice(-2);
      var today = year + '-' + month + '-' + day;
      this.$u.api.searchListForTeacherId({
        teacherId: this.vuex_teacherId,
        claDate: today
      }).then(response => {
        if (response.code == 200) {
          if (response.data == '') {
            this.current = 0
          } else {
            this.courseList = response.data
            this.current = 1
          }
        } else {
          uni.showToast({
            title: '服务器出错',
            icon: 'error'
          })
        }
      })
    },
		navTo(url) {
			uni.navigateTo({
				url: url
			});
		},
		imgListClick(index) {
			console.log(`点击了第${index + 1}页图片`)
		},
		itemClick(index) {
			console.log(index);
		}
	}
};
</script>
<style lang="scss">
@import 'index.scss';
 page {
   
   background-color: #f8f8f8; /* 设置页面的背景色为浅灰色 */
 }
.banner-box{
	padding: 0 2%;
	width: 96%;
	height: 170rpx;
	margin: 30rpx 0 30rpx;
}
.u-swiper-wrap{
	padding:0 10px;
}

.banner-pic{
	width: 47%;
	float: left;
	display: inline-block;
	margin: 0 1.5%;
}
.banner-pic image{
	width: 100%;
	height: 170rpx;
	border-radius: 12rpx;
	box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
}

.u-mode-light-info{
    background-color: #ffffff;
    color: #666666;
    border: 1px solid #e9ecf6;
	font-size: 12px;
	padding: 2px 8px;
	position: relative;
	top:-3px;
}
.workbench-title{
	font-size: 32rpx;
	font-weight: bold;
	color: #333333;
	padding: 15px 30rpx;
}
.workbench-titles{
	font-size: 32rpx;
	font-weight: bold;
	color: #333333;
	padding: 15px 30rpx;
}

.workbench-titles::before {
  content: "";
  position: absolute;
  left: 20rpx;
  margin-top: 1rpx;
  width: 6rpx; /* 竖形图案的宽度 */
  height: 43rpx;
  background-color: #f00; /* 竖形图案的颜色 */
}
 .home-icon i.icon-tongzhi{
	font-size: 22px;
 }
</style>
